import React from "react";
import ReactDOM from "react-dom";

import App from "./App";

import { createStore } from "redux";
import { Provider } from "react-redux";

const reducer = (state = { value: 0 }, action) => {
  switch (action.type) {
    case "ADD":
      state.value = state.value + 1;
      console.info("ADD", state.value);
      return { ...state };
    case "DEL":
      state.value = state.value - 1;
      console.info("DEL", state.value);
      return { ...state };
    default:
      return state;
  }
};

const store = createStore(reducer);

ReactDOM.render(
  <Provider store={store}>
    <App />
  </Provider>,
  document.getElementById("root")
);
